package ca.llsutherland.squash.persistence;

import ca.llsutherland.squash.configuration.SquashLadderConfiguration;

public class DatabaseConnectionManager {

    private AbstractDatabaseConnection databaseConnection;
    private static DatabaseConnectionManager instance = new DatabaseConnectionManager();

    public static DatabaseConnectionManager getInstance() {
        return instance ;
    }

    public void initialize() throws InstantiationException, IllegalAccessException, ClassNotFoundException{
        this.databaseConnection = (AbstractDatabaseConnection) SquashLadderConfiguration.getInstance().getDatabaseConnection();
    }

    public AbstractDatabaseConnection getDatabaseConnection() {
        return this.databaseConnection;
    }

    public void registerNewDomainObject(Long id, String tableName) {
        this.databaseConnection.registerNewDomainObject(id, tableName);
    }

    public void deleteNewDomainObjects() {
        this.databaseConnection.deleteNewDomainObjects();
    }

    public void removeDomainObject(Long idToRemove) {
        this.databaseConnection.removeDomainObject(idToRemove);
    }
}
